int busquedaBinaria(vector<int>  vector, int dato)     
{
  int centro, inf=0, sup = vector.size()-1;

  while(inf<=sup){
    centro = (sup+inf)/2;
    if(vector[centro] > dato)
    {
	    sup = centro-1;
    }
    else
    {
	    inf = centro+1;
    }
  }
  if (vector[centro]<=dato){return centro;}
  return centro-1;
}

void funcionPrincipal()
{
  int diasInspector, cantCamiones;       
  int diaMax = 0;                         
  int cantMax = 0;                         
  int indiceUltimoDia=0;

  vector<int> camiones = pedir_entrada(diasInspector, cantCamiones);   

  for (int i = 0; i < cantCamiones; i++)                              
  {
    int primerDia = camiones[i];
    int ultimoDia = primerDia+diasInspector-1;

    indiceUltimoDia = busquedaBinaria(camiones, ultimoDia);

    if ((indiceUltimoDia - i+1) > cantMax)
    {
      diaMax = camiones[i];
      cantMax = (indiceUltimoDia - i+1);
    }
  }
  return;
}

